package org.dandsoft.blackbox.laboratory.tools.generator;

import org.dandsoft.blackbox.SignalId;

import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.Hashtable;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class SignalsGenerator {

    private Set<SignalId> signals = new HashSet<SignalId>();

    public SignalsGenerator(Set<SignalId> signals) {
        this.signals = signals;
    }

    public SignalsGenerator(SignalId... signals) {
        for (SignalId id : signals) {
            this.signals.add(id);
        }
    }

    public Map<SignalId, Integer> generate() {
        Map<SignalId, Integer> result = new Hashtable<SignalId, Integer>();
        for (SignalId signalId : signals) {
            if ((Math.random() * 2 < 1)) {
                result.put(signalId, 0);
            } else {
                result.put(signalId, 1);
            }
        }

        return result;
    }
}
